package com.cjm.algorithm.shuanzhizhen;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

public class Ti832 {
    public static void main(String[] args) {

    }
    public int[][] flipAndInvertImage(int[][] image) {
        for (int i = 0; i < image.length; i++) {
            int[] ints = image[i];
            int top = 0;
            int down = ints.length - 1;

            while (top < down) {
                int temp = ints[top];
                int tep = ints[down];
                ints[top] = tep;
                ints[down] = temp;

                top++;
                down--;
            }
        }

        for (int i = 0; i < image.length; i++) {
            int[] ints = image[i];
            for (int i1 = 0; i1 < ints.length; i1++) {
                ints[i1] = ints[i1] == 0 ? 1:0;
            }
        }

        return image;
    }
}
